NetHavoc Scenario API

Overview

Chaos engineering is a practice in software development and system operations that involves intentionally injecting controlled disruptions or failures into a system to test its resilience and identify potential weaknesses. The primary goal of chaos engineering is to proactively uncover and address vulnerabilities in a system’s architecture, infrastructure, and design before they lead to unexpected outages or failures in real-world scenarios.

Cavisson NetHavoc is a chaos engineering tool that can be used to inject chaos faults into server states, networks, and applications, offering a wide range of havoc/fault categories and robust monitoring capabilities.

Users can test system and application resiliency and reliability through NetHavoc by monitoring real-time graphs during havoc/fault injection.

Additionally, NetHavoc has introduced its scenario REST API for integration with various load testing tools such as Load Runner, NetStorm, BlazeMeter, JMeter, and other load testing tools

Using The NetHavoc Rest API

Enable havoc execution with load tests using the REST API below.

Curl Example

curl -X POST \

    –header “CavToken: $CavToken” \

    https://$CavServerHost/DashboardServer/netHavoc/NHScenarioDataService/startNHscenario \

    –data ‘{“scenarioName”:”$HavocScenario”}’

API Details

HTTP Method

POST

Endpoint URL

https://cloudpoc0.cav-test.com/DashboardServer/netHavoc/NHScenarioDataService/startNHscenario

Request Header

CavToken: C0od5o8JTYG41ofvcDgzUxe%2Bn9mxEKtIAWNJDQD0dWE7BjgwhnMB

P5s0N69n7J3FPkTt%2FKrSUFNTLr5xBvU4g9dkT%2BxhpS9TNrIW7Zv

2QHMfMV0deZ4ql3F8D%2FIvCmFdAk13zxqB%2Fa2OG7iIu4wHgW4

WBUDdUvSjNx57Y35g6dM%3D

Request Body

{“scenarioName”:”CpuBurst”}

Note:

It is crucial to ensure that only one virtual user executes this script at any given time.

API Parameterization Details:

  • CavServerHost: Specifies the target machine on which havoc scenarios are generated.
  • HavocScenario: Represents the specific havoc scenario created on the target machine.
  • CavToken: This authentication token serves as verification for REST calls. It informs the server that the bearer of this token is authorized to access and execute designated operations.

Token Generation Steps:

To generate the required token, follow these steps:

  1. Log in to the Cavisson user interface (UI).
  2. Navigate to the User Options.
  3. Generate the token from the designated “Generate Token” option.

Example

Here, is an example of NetHavoc API integration with load runner script.

Below, this is a sample script which consists of parameterized host, havoc scenario, token ID.

OUTPUT:

After executing the scenario in Load Runner, check the machine on which you designed the scenario. You will notice that your scenario is currently in the running process

To check the status of the scenario, navigate to the scenario report.